﻿var ksja=1;
var mgta=5;
var ksjb=1;
var mgtb=5;
var dbbj='http://dokimastiko19.blogspot.com/feeds/';
var xeik='http://4.bp.blogspot.com/-P3wLAz3wZmE/Tl7pWM-cnXI/AAAAAAAAAUw/w9cd5C55D7g/s72-c/noimage.jpg'
var thldnga='<img height=\'18\' alt=\'loading\' width=\'18\' src=\'http://1.bp.blogspot.com/-EvpUYZOZesI/TnBcWZnd8ZI/AAAAAAAAAVw/1NzFjn8DGdY/s18-c/loading.gif\' />';

//prosfates anarthseis
function bsfja(bs){
japa=document.getElementById('dvjaa');
japb=document.getElementById('dvjab');
japc=document.getElementById('dvjac');
olaaa='';olaab='';
for(a=0;a<bs.feed.entry.length;a++){b=bs.feed.entry[a];g=b.title.$t;
for(d=0;d<b.link.length;d++){if(b.link[d].rel=='alternate'){e=b.link[d].href}}
try{z=b.media$thumbnail.url}catch(error){
h=b.content.$t;k=h.indexOf('<img');n=h.indexOf('src=\' ',k);o=h.indexOf('\'',n+5);m=h.substr(n+5,o-n-5);
if((k!=-1)&&(n!=-1)&&(o!=-1)&&(m!='')){z=m}else z=xeik}
olaaa+='<li><a href=\''+e+'\' title=\''+g+'\'><img height=\'72\' alt=\''+g+'\' width=\'72\' src=\''+z+'\' /><div class=\'text\'>'+g+'</div></a></li>'}
if(ksja!=1){olaab+='<button onclick=\'prva()\'>&#9668;</button>'}
else{olaab+='<button onclick=\'prva()\' disabled>&#9668;</button>'}
if(bs.feed.entry.length==mgta){olaab+='<button onclick=\'nxta()\'>&#9658;</button>'}
else{olaab+='<button onclick=\'nxta()\' disabled>&#9658;</button>'}
japa.innerHTML='<ul class=\'list\'>'+olaaa+'</ul>';
japb.innerHTML='<div class=\'preving\'>'+olaab+'</div>';
japc.innerHTML='';}
function frta(){a=document.createElement('script');
a.src=dbbj+'posts/default?orderby=published&start-index='+ksja+'&max-results='+mgta+'&alt=json-in-script&callback=bsfja';
document.documentElement.firstChild.appendChild(a);}
function nxta(){japb.innerHTML='<button disabled>&#9668;</button><button disabled>&#9658;</button>';japc.innerHTML=thldnga;ksja=ksja+mgta;frta();}
function prva(){japb.innerHTML='<button disabled>&#9668;</button><button disabled>&#9658;</button>';japc.innerHTML=thldnga;ksja=ksja-mgta;frta();}

//prosfata sxolia
function bsfjb(bs){
jbpa=document.getElementById('dvjba');
jbpb=document.getElementById('dvjbb');
jbpc=document.getElementById('dvjbc');
ola='';ola2='';
for(a=0;a<bs.feed.entry.length;a++){
b=bs.feed.entry[a];
for(c=0;c<b.link.length;c++){
if(b.link[c].rel=='alternate'){
d=b.link[c].href}}
if(b.content){e=b.content.$t}else if(b.m){e=b.m.$t}
f=/<\S[^>]*>/g;e=e.replace(f,'');g=b.author[0].name.$t;
if(e.length<70){e=e}else{e=e.substring(0,70)}
if(g=='Anonymous'){g='Ανώνυμος'}
ola+='<li><a href=\''+d+'\'><div class=\'img fwto5\'></div><div class=\'text\'><b>'+g+'</b> είπε: '+e+'...</div></a></li>'}
if(ksjb!=1){ola2+='<button onclick="prvb()">&#9668;</button>'}
else{ola2+='<button onclick="prvb()" disabled>&#9668;</button>'}
if(bs.feed.entry.length==mgtb){ola2+='<button onclick="nxtb()">&#9658;</button>'}
else{ola2+='<button onclick="nxtb()" disabled>&#9658;</button>'}
jbpa.innerHTML='<ul class=\'list\'>'+ola+'</ul>';
jbpb.innerHTML='<div>'+ola2+'</div>';
jbpc.innerHTML='';}
function frtb(){a=document.createElement('script');
a.src=dbbj+'comments/default?orderby=published&start-index='+ksjb+'&max-results='+mgtb+'&alt=json-in-script&callback=bsfjb';
document.documentElement.firstChild.appendChild(a);}
function nxtb(){jbpb.innerHTML='<button disabled>&#9668;</button><button disabled>&#9658;</button>';jbpc.innerHTML=thldnga;ksjb=ksjb+mgtb;frtb();}
function prvb(){jbpb.innerHTML='<button disabled>&#9668;</button><button disabled>&#9658;</button>';jbpc.innerHTML=thldnga;ksjb=ksjb-mgtb;frtb();}

// sxetikes anarthseis
ccc=new Array();
ddd=0;
eee=new Array();
fff=new Array();
function sxetikes(json){
for(aaa=0;aaa<json.feed.entry.length;aaa++){
bbb=json.feed.entry[aaa];
ccc[ddd]=bbb.title.$t;
try{
fff[ddd]=bbb.media$thumbnail.url;}
catch(error){}
if(ccc[ddd].length>50);
ccc[ddd]=ccc[ddd].substring(0,50)+'...';
for(k=0;k<bbb.link.length;k++){
if(bbb.link[k].rel=='alternate'){
eee[ddd]=bbb.link[k].href;
ddd++;
}}}}
function sxetikesc(){
for(i=0;i<eee.length;i++){
if((eee[i]==top.location.href)||(!ccc[i])){
eee.splice(i,1);
ccc.splice(i,1);
fff.splice(i,1);
i--;}}
r=Math.floor((ccc.length-1)*Math.random());
i=0;
if(ccc.length>0)
document.write('<ul id=\'sxetika\'>');
while (i<ccc.length && i<20 && i<5){
aaa=fff[r];
aaa=aaa.replace('/s72-c/','/s99-c/');
titlos=ccc[r];
tourl=eee[r];
document.write('<li><a href=\''+tourl+'\' title=\''+titlos+'\'><img width=\'99\' height=\'99\' alt=\''+titlos+'\' src=\''+aaa+'\' /><div class=\'rel_p\'>'+titlos+'</div></a></li>');
i++;
if(r<ccc.length-1){r++;}
else{r=0;}}
document.write('</ul>');
eee.splice(0,eee.length);
fff.splice(0,fff.length);
ccc.splice(0,ccc.length);}

// kalesma gia sxetikes anarthseis
function sxetikesa(){aa=document.getElementById("mytag").innerHTML;
document.write('<script src=\'http://dokimastiko19.blogspot.com/feeds/posts/default/-/'+aa+'?alt=json-in-script&callback=sxetikes&max-results=6\'></script>');}

// μαρκάρισμα κατηγορίας
function markarisma(){
aa=document.getElementById('mytag');
bb=document.getElementById('koinwnia');
cc=document.getElementById('politikh');
dd=document.getElementById('oikonomia');
ee=document.getElementById('texnologia');
ff=document.getElementById('paraksena');
gg=document.getElementById('saturika');
hh=document.getElementById('die8nh');
ii=document.getElementById('a8lhtika');
jj=document.getElementById('apopseis');
if(aa.innerHTML=='Κοινωνία'){bb.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Κοινωνία'){bb.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Πολιτική'){cc.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Πολιτική'){cc.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Οικονομία'){dd.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Οικονομία'){dd.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Τεχνολογία'){ee.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Τεχνολογία'){ee.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Παράξενα'){ff.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Παράξενα'){ff.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Σατυρικά'){gg.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Σατυρικά'){gg.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Διεθνή'){hh.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Διεθνή'){hh.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Αθλητικά'){ii.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Αθλητικά'){ii.setAttribute('className', 'select fwto2');}
if(aa.innerHTML=='Απόψεις'){jj.setAttribute('class','select fwto2');}
if(aa.innerHTML=='Απόψεις'){jj.setAttribute('className', 'select fwto2');}}




// se nea kartela ola ta link pou den arxizoun apo dokimastiko
function target(){
aa=document.getElementsByTagName('a');
for(i=0;i<aa.length;i++){
bb=aa[i].href;
gg=bb.substring(0,20);
if(gg!='http://dokimastiko19'){
aa[i].setAttribute('target', '_blank');aa[i].setAttribute('rel','nofollow');}}
bb=document.getElementById('sxetika').getElementsByTagName('a')[0];bb.style.borderLeft="none";}

// dunamikh fortwsh formas sxoliwn
function loadform(){
rr=document.forma.tolink.value;
aa=document.getElementById('forma');
cc=document.createElement('script');
cc.src='http://www.blogger.com/static/v1/jsbin/957670695-comment_from_post_iframe.js';
aa.appendChild(cc);
bb=document.createElement('iframe');
bb.src=rr;
bb.style.width='600px';
bb.style.height='250px';
bb.name='iframe';
bb.frameBorder="0";
aa.appendChild(bb);
document.getElementById('stopload').style.display="none";}

// share on facebook
function fshare(){
ee=top.location.href;
testwindow=open('http://www.facebook.com/sharer/sharer.php?u='+ee+'','twin','location=1,status=1,scrollbars=1,width=400,height=400')}

// share on twitter
function tshare(){
ee=window.location.href;
titlos=document.getElementsByTagName('h1')[1].innerHTML;
testwindow= open('http://twitter.com/intent/tweet?url='+ee+'&text='+titlos+'','fwin','location=1,status=1,scrollbars=1,width=400,height=400')}

// standard cookies 
function createCookie(name,value,days){
if(days){
date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires=";expires="+date.toGMTString();}
else expires="";
document.cookie=name+"="+escape(value)+expires+";path=/";
}
function readCookie(name){
nameEQ=name+"=";
ca=document.cookie.split(';');
for(i=0;i<ca.length;i++){
c=ca[i];
while(c.charAt(0)==' ')c=c.substring(1,c.length);
if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);
}return null;
}

// cookies gia float left kai right
function mainfloat(){
float1=document.getElementById("main-wrapper");
float1.style.cssFloat="right";
float1.style.styleFloat="right";
float2=document.getElementById("sidebar-wrapper");
float2.style.cssFloat="left";
float2.style.styleFloat="left";
cc='#main-wrapper{float:right;}#sidebar-wrapper{float:left;}';
createCookie('float', cc, '365');
}
function delfloat(){
float1=document.getElementById("main-wrapper");
float1.style.cssFloat="left";
float1.style.styleFloat="left";
float2=document.getElementById("sidebar-wrapper");
float2.style.cssFloat="right";
float2.style.styleFloat="right";
createCookie('float','','-1');
}
function desfloat(){
document.getElementById("float").innerHTML=unescape(readCookie('float'));
}


// cookies gia apo8hkeush ar8rou
function getCookies() {
aa=document.cookie.match(new RegExp('(^|;)?mypost[0-9]{18}=([^;]*)','gi'));
bb=unescape(aa);
if(aa){
cc=/mypost\d{18}\=/ig;
dd=bb.replace(cc,"");
ee=dd.split(',');
ee=ee.join('');
document.getElementById("savebox-body").innerHTML=unescape(ee);
}}
function save1(bs){
aa=bs.parentNode.parentNode.parentNode.getElementsByTagName('h2')[0].getElementsByTagName('a')[0].href.substring(33);
bb=bs.parentNode.parentNode.parentNode.getElementsByTagName('div')[0].getElementsByTagName('img')[0].src;
cc=bs.parentNode.parentNode.parentNode.getElementsByTagName('h2')[0].getElementsByTagName('a')[0].innerHTML;
dd=bs.parentNode.parentNode.parentNode.getElementsByTagName('div')[0].id.substring(0,24);
ola='<div class="savebox"><a class="saveboxlist" href='+aa+'><img height="72" width="72" src="'+bb+'" /><div class="saveboxtext">'+cc+'</div></a><button class="saveboxdel" onclick="savepostdel1(\''+dd+'\');savepostdel2(this)">delete</button></div>';
document.getElementById('savebox-body').innerHTML+=ola;
createCookie(dd,ola,365);
seesave();
}
function save2(bs){
aa=bs.parentNode.parentNode.parentNode.getElementsByTagName('h1')[0].getElementsByTagName('a')[0].href.substring(33);
bb=bs.parentNode.parentNode.parentNode.getElementsByTagName('div')[0].getElementsByTagName('img')[0].src;
cc=bs.parentNode.parentNode.parentNode.getElementsByTagName('h1')[0].getElementsByTagName('a')[0].innerHTML;
dd=bs.parentNode.parentNode.parentNode.getElementsByTagName('div')[0].id.substring(0,24);
ola='<div class="savebox"><a class="saveboxlist" href='+aa+'><img height="72" width="72" src="'+bb+'" /><div class="saveboxtext">'+cc+'</div></a><button class="saveboxdel" onclick="savepostdel1(\''+dd+'\');savepostdel2(this)">delete</button></div>';
document.getElementById('savebox-body').innerHTML+=ola;
createCookie(dd,ola,365);
}
function savepostdel1(name){
createCookie(name,"",-1);
}
function savepostdel2(bs){
bs.parentNode.parentNode.removeChild(bs.parentNode);
}


//gia na mh mas kanoun iframe
function noframe(){
if(window!=top){top.location.href=location.href;}
}

//fortwsh javascript gia lightbox images
function load_lightbox(){
document.write('<scr'+'ipt src=\'http://www.gdoop.com/lightbox.js\'></scr'+'ipt>');
}

// see save 
function seesave(){
aa=getElementsByClassName("savepost");
bb=document.getElementById("savebox-body");
positionre=bb.style.position;
topre=bb.style.top;
for (i=0; i<aa.length; i++){
aa[i].onmouseover=function(){bb.style.position="fixed";bb.style.top=0;};
aa[i].onmouseout=function(){bb.style.position=positionre;bb.style.top=topre;};
}
}

//ti tha fortwnei sth selida 
window.onload=function(){
noframe();
frtb();  // prosfates anarthseis
frta();  // prosfata sxolia
tsek();
}